package com.learning.hadoop.mapreduce.weather;

import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Partitioner;

/**
 * ClassName: FirstPartition
 * Description: 自定义分区,按照年份分区
 * Date: 2018/3/25 21:51 【需求编号】
 *
 * @author Sam Sho
 * @version V1.0.0
 */
public class FirstPartition extends Partitioner<KeyPari, Text> {

    @Override
    public int getPartition(KeyPari key, Text value, int num) {
        return (key.getYear() * 127) % num;
    }
}
